from django.contrib.auth.models import User
from django.db import models

# Create your models here.
class Member(models.Model):
    name = models.CharField(max_length=32)
    p_num = models.CharField(max_length=32, blank=True, null=True)
    id_num = models.CharField(max_length=32)
    company = models.CharField(max_length=64)
    role = models.CharField(max_length=128, blank=True, null=True)
    is_delete = models.BooleanField(default=False, blank=True)

    def __str__(self):
        return self.name

class Liscense(models.Model):
    member = models.ForeignKey(Member, on_delete='CASCADE')
    name = models.CharField(max_length=32)
    level = models.CharField(max_length=32)
    organ = models.CharField(max_length=64)
    start_date = models.DateField(blank=True, null=True)
    empire_date = models.DateField()
    pdffile = models.FileField(upload_to='liscenses/', blank=True, null=True)
    is_confirmed = models.BooleanField(default=False)
    confirm_user = models.ForeignKey(User, on_delete='CASCADE', blank=True, null=True)
    is_delete = models.BooleanField(default=False)

    def __str__(self):
        return self.member.name + self.name + self.level





